package com.fk.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.fk.entity.ShangPinXiangQing;
import com.fk.util.DBManager;

public class ShangPinXiangQingDaoImpl {
		public List<ShangPinXiangQing> getShangPinXiangQingList(int cId){
			List<ShangPinXiangQing> xqList=new ArrayList<ShangPinXiangQing>();
			Connection conn=DBManager.getConnection();
			Statement st=null;
			ResultSet rs=null;
			try {
				st=conn.createStatement();
				rs=st.executeQuery("SELECT*FROM shangpinxiangqing WHERE feiLeiId="+cId);
				while(rs.next()) {
					int cqId=rs.getInt("sahngpinid");
					String name=rs.getString("name");
					String imgs=rs.getString("img");
					ShangPinXiangQing xq=new ShangPinXiangQing(cqId, name, imgs);
					xqList.add(xq);
				}
				return xqList;
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}finally {
				DBManager.closeAll(conn, st, rs);
			}
			
		}
}
